<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page language="java" import="com.tjtt.common.utils.DateUtilsAll"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String mainid = request.getParameter("mainid");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
     <base target="_self"/>
    <link rel="stylesheet" type="text/css" href="<%=path %>/web/style/layout.css" />
    <script type="text/javascript" src="<%=path %>/jqGrid/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="<%=path %>/jslib/jquery.validate.min.js"></script>
    <script type='text/javascript' src="<%=request.getContextPath() %>/jslib/My97DatePicker/WdatePicker.js" defer="defer"></script>
    <script type='text/javascript' src="<%=request.getContextPath() %>/jslib/jquery.form.js"></script>
    <script type="text/javascript" src="<%=request.getContextPath() %>/jslib/additional-methods.js"></script>
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/demo.css">
	<script type="text/javascript" src="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/jquery.easyui.min.js"></script>
    <c:if test="${requestScope.message!=null}">
		<script type="text/javascript">
 	 		     alert('<c:out value="${requestScope.message}"></c:out>');
 	 		     window.close();
 		</script>
	</c:if>
	<script type="text/javascript">
	var api = frameElement.api, W = api.opener;
    var stateValue="";
		$().ready(function(){
			var options = {
		  	    url:'<%=request.getContextPath() %>/shebeiweibaoAction!shenpirenshenpi.action?steptype='+$("#steptype0").val()+'&taskinfoid='+${taskinfoid},
		  	     beforeSubmit: function() {
		   				return checking();
		    			},
		  	     dataType:'json',
		  	    success: function(data) {
		  	      if(data.result=='success'){
					alert("提交成功");
					api.close();
					W.refreshIt();
		  	      }
		  	    }
		  	   };
			$('#saveBtn').click(function(){
			    	$('#pageFrom').ajaxSubmit(options);
	 	            return false;
    	 	});
	    	$('#closeBtn').click(function(){
	    		api.close();
				});
		});
	function checking(){
	   		var flag = true;
			var shenpiren = $("#shenpiren").val();
			var shenpiyijian = $("#shenpiyijian").val();
			var shenpitime = $("#shenpitime").val();
			if(shenpiren ==null || shenpiren == "" ){
				alert("审批人不能为空！");
				$("#shenpiren").focus();
	    		return false;
			}
			if(shenpiyijian == null && shenpiyijian == ""){
				alert("审批意见不能为空！");
				$("#shenpiyijian").focus();
	    		return false;
			}
			if(shenpitime ==null || shenpitime == "" ){
				alert("时间不能为空！");
				$("#shenpitime").focus();
	    		return false;
			}
			
		}
		function dahui(){
        var actionUrl = '<%=request.getContextPath()%>/shebeiweibaoAction!tuihuiweibao.action'; 
        var param = {
                      "flowname":$("#flowname").val(),
                      "flowid":"${flowid}",
                      "stateid":"${stateid}",
                      "steptypeback":$("#steptypeback0").val(),
                      "taskinfoid":"${taskinfoid}",
                      "id":$("#id").val()
            };
    	$.ajax({  
			        url : actionUrl,  
			        type : "post", 
			        data : param,  
			        dataType : "json",  
			        cache : false,  
			 error : function(textStatus, errorThrown) {  
			        alert("系统ajax交互错误: " + textStatus.value);  
		    },  
		    success : function(data, textStatus) {
		        if(data.ajaxResult=='success'){ 
		        //      window.returnValue = returnValue;     
				      alert("打回成功");
				      W.reload();
					  api.close();
                   }else{
                       alert("处理失败!");
                       W.reload();
                   }
		    }    
			});
    }
	</script>
	
	
  </head>
  
  <body>
  		<form id="pageFrom" action="" enctype="multipart/form-data" method="post">
        <input type="hidden" id="flag" name="flag" />
        <input type="hidden" name="flowid" id="flowid" value="${flowid}">
     	<input type="hidden" name="stateid" id="stateid" value="${stateid}">
     	${steptcontent}
     	${steptcontentback}
		<input type="hidden" name="id" id="id" value="${Shebeiweibao.id}">
  		<table width="100%" border="0" align="center" cellpadding="5" cellspacing="5" class="formTableNew" style="padding-top: 20px">
  			 <tr>
			  	<td align="right">流程名称:</td>
			  <td align="left">
			  	<input type="text" id="flowname" name="flowname" maxlength="50" value="${flowname}" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;">
			  </td>
     		<td>
  			</tr>
  			<tr>
  			  <td align="right">设备名称：</td>
  			  <td align="left">
  			    <input type="hidden" readonly="readonly" id="shebeiid" name="shebeiid" value="${Shebeiweibao.shebeiid}"/>
  			    <input  type="text" readonly="readonly" id="shebeiname" maxlength="50" name="shebeiname" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeiweibao.shebeiname }" />
  			  </td>
  			  <td align="right">设备编号：</td>
  			  <td align="left">
  			    <input  type="text" readonly="readonly" id="shebeino" maxlength="50" name="shebeino" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeiweibao.shebeino }" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">规格型号：</td>
  			  <td align="left">
  			    <input  type="text" readonly="readonly" id="gugexinghao" maxlength="50" name="gugexinghao" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeiweibao.gugexinghao }" />
  			  </td>
  			  <td align="right">部门：</td>
  			  <td align="left">
  			  	<input type="hidden" readonly="readonly" id="bumenid" name="bumenid" value="${Shebeiweibao.bumenid } "/>
  			    <input  type="text" readonly="readonly" id="bumenname" maxlength="50" name="bumenname" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeiweibao.bumenname }" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">序号：</td>
  			  <td align="left">
  			    <input  type="text" readonly="readonly" id="xuhao" maxlength="50" name="xuhao" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeiweibao.xuhao }" />
  			  </td>
  			  <td align="right">维护保养项目：</td>
  			  <td align="left">
  			    <input  type="text" readonly="readonly" id="weibaoxiangmu" maxlength="50" name="weibaoxiangmu"  style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeiweibao.weibaoxiangmu }" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">维护保养基准：</td>
  			  <td align="left">
  			    <input  type="text" readonly="readonly" id="weibaojizhun" maxlength="50" name="weibaojizhun" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeiweibao.weibaojizhun }" />
  			  </td>
  			  <td align="right">测量变量的方法：</td>
  			  <td align="left">
  			    <input  type="text" readonly="readonly"  id="celiangbianliang" maxlength="50" name="celiangbianliang"  style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeiweibao.celiangbianliang }" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">保养级别：</td>
  			  <td align="left">
  			    <input  type="text" readonly="readonly" id="baoyangjibie" maxlength="50" name="baoyangjibie" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeiweibao.baoyangjibie }" />
  			  </td>
  			  <td align="right">工具：</td>
  			  <td align="left">
  			  	 <input  type="text" readonly="readonly" id="gongju" readonly maxlength="50"  name="gongju" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeiweibao.gongju }" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">劳保：</td>
  			  <td align="left">
  			    <input  type="text" readonly="readonly" id="laobao" maxlength="50" name="laobao" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeiweibao.laobao }" />
  			  </td>
  			  <td align="right">操作要点：</td>
  			  <td align="left">
  			    <input  type="text" readonly="readonly" id="caozuoyaodian" maxlength="50" name="caozuoyaodian" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeiweibao.caozuoyaodian }" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">保养周期: </td>
  			  <td align="left">
  			    <input  type="text" readonly="readonly" id="baoyangzhouqi" readonly maxlength="50" name="baoyangzhouqi" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeiweibao.baoyangzhouqi }" />
  			  </td>
  			 <td align="right">上次维护时间：</td>
  			  <td align="left">
  			    <input  type="text" readonly="readonly" id="shangciweibaotime" readonly maxlength="50" name="shangciweibaotime" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeiweibao.shangciweibaotime }" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">提前提醒天数:</td>
  			  <td align="left">
  			    <input  type="text"  id="tixingtianshu"  maxlength="50" name="tixingtianshu" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeiweibao.tixingtianshu }" />
  			  </td>
  			</tr>
 			<tr>
  			  <td align="right">修改描述:</td>
  			  <td align="left">
  			    <input  type="text"  id="xiugaimiaoshu"  maxlength="50" name="xiugaimiaoshu" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeiweibao.xiugaimiaoshu }" />
  			  </td>
  			  <td align="right">更改原因：</td>
  			  <td align="left">
  			    <input  type="text"  id="genggaiyuanyin"  maxlength="50" name="genggaiyuanyin"  style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="${Shebeiweibao.genggaiyuanyin }" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">审批人:</td>
  			  <td align="left">
  			    <input  type="text"  id="shenpiren"  maxlength="50" name="shenpiren" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="<%=session.getAttribute("username") %>" />
  			  </td>
  			  <td align="right">审批时间：</td>
  			  <td align="left">
  			    <input  type="text"  id="shenpitime"  maxlength="50" name="shenpitime" onChange="changeDate()" onClick="WdatePicker({maxDate:new Date()})" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="<%=DateUtilsAll.dateToStringShort(new Date()) %>" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">审批意见:</td>
  			  <td align="left">
  			   <textarea rows="5" cols="100" id="shenpiyijian" name="shenpiyijian" onkeydown="countlen1(this);" style="width: 250px;"></textarea>
  			  </td>
  			</tr>
 			
		</table>
		<table width="100%" border="0" align="center" class="formTableNew">
		  <tr>   
			<td align="center">
		    	<input id="saveBtn" type="button" value="提 交" class="form_bt_orange" />
		    	<input type="button" id="backBtn" onclick="dahui()" value="退回" class="form_bt_orange" />
		    	<input type="button" id="closeBtn" value="取 消" class="form_bt_grey" />
		    </td>
		  </tr>
		</table>
	<!--表单结束-->
	</form>
  </body>
</html>
